1. Field of the Invention
The present invention relates to a linear scale reader.
2. Description of the Prior Art
Conventionally, some of machine tools are provided with, for example, glass linear scales for reading the position of a workpiece. In the linear scale, light is illuminated onto the linear scale and a relative travel distance of a workpiece can be measured using the reflected light.
In some known linear scales, magnetic score marks are inscribed in a metal scale and movement of the scale can be read by means of variations in magnetic field.
Such a linear scale generally is provided with an operation circuit which computes lower measured values obtained by sub-dividing one pitch of the scale, in order to obtain higher precision than a pitch between score marks.
FIG. 4 shows schematically a method of reading the above-mentioned linear scale. Referring to FIG. 4, a glass linear scale 10, which forms a length measuring apparatus, is provided a main scale 10a and a sub-scale 10b. 
Each of the scales 10a and 10b includes a grid having score mark formed at predetermined intervals. A relative movement between the main scale 1a and the sub-scale 1b is detected by detecting Moire fringes of light passing through the score marks of the two scales.
An optical system 20 illuminates light onto the linear scale 10. The optical system 20 generally includes a light emitting element 21 and light receiving elements 22(a) and 22(b). The light emitting element 21 illuminates light onto the linear scale 10. Each of the two light receiving element 22(a) and 22(b) detects a Moire fringes based on translucent light or reflected light of the illuminated light and then converts them into an electrical signal. When the scale travels at a constant rate, a relative movement thereof is output as a sine-wave-like Lissajous"" figure.
In this case, by shifting the position of a received light spot, the light receiving element 22a produces an A-phase signal while the light receiving element 22b produces a B-phase signal, the A-phase signal and the B-phase signal being shifted 90xc2x0 from each other. Thus, the travel direction of the scale can be detected.
The A-phase signal is supplied to the amplifier 23a and the B-phase signal is supplied to the amplifier 23b. The amplifier 23a, 23b is formed of, for example, a high-gain differential amplifier. The amplifier 23a converts the A-phase signal into a voltage signal level of about 2 Vp-p and the amplifier 23b converts the B-phase signal into a voltage signal level of about 2 Vp-p. The amplifier 23a supplies the converted signal to the A/D converter 24(a), which converts an analog signal into a digital signal. The amplifier 23b supplies the converted signal to the A/D converter 24(b).
The comparator 25 receives the outputs of the amplifiers 23a and 23b and then converts them into rectangular waveforms inverted to zero levels. For example, the upper counter 26 receives the B-phase signal, of which the phase is shifted 90xc2x0, and then counts, for example, the rising edges of rectangular waves.
When the main scale 10a shits from the sub-scale 10b by one pitch, the upper counter 26 outputs the measured length data N of upper bits, in which the count value is incremented by 1.
The A/D converter 24a, 24b samples sine wave detection signals, each representing a relative value of an input sine wave scale, every predetermined phase intervals, and then outputs them as digital values.
In this case, the A/D converter 24(a) samples an A-phase detection signal and then outputs the sampled signal as a digital signal. The A/D converter 24(b) samples a B-phase detection signal and then outputs the sampled signal as a digital signal. As described later, the phase division data of a sine wave signal is computed based on both the sampling values. The phase division data with high precision, obtained by further dividing the upper data, is output. That is, a ROM table 27 which previously stores lower data is read out, with the outputs of the A/D converters 24a and 24b acting as address signals. Thus, the lower data n, obtained by multiplying one pitch of the scale by a phase division number, is output.
An adder 28 adds the lower measured length data n read out from the ROM table and the upper data N in which one pitch unit of the scale is a measured length value and then supplies its output to a measured length display (not shown).
The measured length display latches and manifests the value of a request signal.
FIG. 5 shows a sine-wave-like A-phase signal iA and a sine-wave-like B-phase signal iB, created from Moire fringes generated when a linear scale is relatively moving at a fixed rate.
Ad represents an upper signal waveform output from the comparator 25, inverted at the zero level of an A-phase signal iA. Bd represents an upper signal waveform output from the comparator 25, inverted at the zero level of an B-phase signal iB. In this example, when the scale is moving in one direction, the upper counter 26 produces an addition output of upper bits N at the time the B-phase signal from the comparator 25 rises. When the scale is moving in the opposite direction, a subtraction output from the upper counter is output at the time the B-phase signal falls.
Both the sine-wave Lissajous"" figure A supplied from the A/D converter 23a and the sine-wave Lissajous"" figure B supplied from the A/D converter 23b are sampled every predetermined phases, as shown in FIG. 5. Thus, the lower bit data (n) can be read out from the ROM table, with the sampling data acting as an address signal. As shown in FIG. 5, the lower data n takes a value increasing stepwise and linearly every pitch. By adding upper data N, the resolution of the scale to a relative moving distance is improved.
In the above-mentioned linear scale reading method, because upper data N and lower data n are not output in a synchronous mode, an error may occur in the vicinity of a digit-taking-up of upper data (or a digit-taking-down of upper data).
This process will be explained with reference to FIG. 6.
Referring to FIG. 6, n represents lower position data output when a linear scale is relatively moving at a constant rate. N represents upper count data. The measured length display manifests a value (N+n).
When the lower data becomes 99 normally with the sampling timing Sy, Sx, it is read out with the timing at which the upper data is incremented.
The point where the digit of upper data takes up corresponds to the timing where inversion occurs at the zero level of the B-phase signal. However, the point where the A-phase signal or B-phase signal and the zero level cross changes, for example, due to noises induced slightly. Moreover, the cross point may change due to dust adhered to during movement of the scale.
A change of the cross point makes unstable the timing with which the upper count value N increments, as shown in FIG. 6.
It is now assumed that the lower measured length data is n and that the resolution is 1/100. In the case of n=100, one pitch (0.1 mm) is obtained. In such a case, with the sampling timing S1, because the upper data N is 0 and the lower data n is 90 xcexcm, the relative moving distance is 90 xcexcm.
However, because taking up, or carry, of the digit of the upper data erroneously speeds up with the sampling timing S2, the moving distance to be displayed jumps to 290 xcexcm when the lower data n is 90. Because the moving distance is actually 190 xcexcm, the error is very large.
With the sampling timing S3, the upper count data N is 2 and the lower data n is 10.
Therefore, the relative moving distance of the scale is 210 xcexcm. However, the accurate measured length value is 310 xcexcm with the sampling timing S3.
As described above, the conventional linear scale measured length reading method has such a disadvantage. That is, because different circuits create lower data n and upper data N, respectively, the measured value jumps by +1 or xe2x88x921 when noises are induced into, particularly, the upper data creation circuit. When that linear scale is used as feedback information for a machine tool, the machine tool cannot be smoothly driven.
The present invention is made to solve the above-mentioned problems.
An object of the invention is to provide a linear scale reader capable of eliminating scale-reading errors.
Another object of the present invention is to provide a linear scale reader that reads intervals between score marks based on upper data and lower data obtained by further sub-dividing the upper data to improve the length measurement precision of the scale.
According to the present invention, a linear scale reader comprises a first length-measuring unit for detecting a measured length value corresponding to a score mark of a linear scale as two-phase signals shifted 90xc2x0 from each other and thus reading as upper data the pitch period of the score mark; a second length-measuring unit for phase dividing two two-phase signals by means of an A/D converter and reading lower data, which is obtained by dividing the period by a predetermined number; a device for outputting a composite value as a linear scale reading value, the composite value obtained by adding the upper data to the lower data; a latch circuit for latching polarities of two-phase signals output from the first length-measuring unit; a quadrant determination circuit for identifying lower data output from the second length-measuring unit, based on a 90-degree phase quadrant of the two-phase signals, and issuing the lower data into four phase areas; and a comparator for comparing a quadrant signal output from the latch circuit with a quadrant signal output from the quadrant determination circuit; whereby a counter output of upper data is corrected within a range of +1 to xe2x88x921, in the vicinity of a digit taking-up of at least upper data and in response to a comparison result from the comparator.